/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.awt.event.*;
import java.io.CharArrayReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.CharBuffer;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PublicKey;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import javax.swing.JPanel;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SpringLayout;
import javax.swing.JTextArea;
/**
 *
 * @author student
 */
public class Okno extends javax.swing.JFrame {
	 PublicKey publiczny;
	 byte[] podpis;
	 String t;
    /**
     * Creates new form Okno
     */
    public Okno() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
       
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jBWybierzPlikSzyfruj = new javax.swing.JButton();
        jBSzyfrujPlik = new javax.swing.JButton();
        jBDeszyfrujPlik = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jBOtworzKlucz = new javax.swing.JButton();
        jBNowyKlucz = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jBWybierzPlikDeszyfruj = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTAWejsce = new javax.swing.JTextArea();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTAWyjscie = new javax.swing.JTextArea();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jBSzyfrujTekst = new javax.swing.JButton();
        jBSzyfrujTekst.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent arg0) {
        	}
        });
        sygnaturka = new javax.swing.JTextArea();
        jBDeszyfrujTekst = new javax.swing.JButton();
        jBNowyKluczTekst = new javax.swing.JButton();
        jBOtworzKluczTekst = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        kluczSzyfrowania="00000000000000000000000000000000";

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jBWybierzPlikSzyfruj.setText("Wybierz plik...");
        jBWybierzPlikSzyfruj.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });
        
        jBNowyKluczTekst.addMouseListener(new MouseAdapter() {
        	public void mouseClicked(MouseEvent evt){
        		utworzNowyKlucz(evt);
        	}
        });

        jBSzyfrujPlik.setText("Szyfruj");
        jBSzyfrujPlik.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });
        
        jBOtworzKluczTekst.addMouseListener(new MouseAdapter() {
        	public void mouseClicked(MouseEvent evt){
        		wczytajKlucz(evt);
        	}
		});
        
        jBSzyfrujTekst.addMouseListener(new MouseAdapter() {
        	public void mouseClicked(MouseEvent evt){
        		try {
					szyfruj(evt);
				} catch (InvalidKeyException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (SignatureException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (NoSuchAlgorithmException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (NoSuchProviderException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
        	}
		});
        
        jBDeszyfrujTekst.addMouseListener(new MouseAdapter() {
        	public void mouseClicked(MouseEvent evt){
        		try {
					deszyfruj(evt);
				} catch (InvalidKeyException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (SignatureException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (NoSuchAlgorithmException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (NoSuchProviderException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (InvalidKeySpecException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
        	}
		});
        
        jBOtworzKlucz.addMouseListener(new MouseAdapter() {
        	public void mouseClicked(MouseEvent evt){
        		wczytajKlucz(evt);
        	}
		});
        
        jBNowyKlucz.addMouseListener(new MouseAdapter() {
        	public void mouseClicked(MouseEvent evt){
        		utworzNowyKlucz(evt);
        	}
		});
        
        jBDeszyfrujPlik.setText("Deszyfruj");

        jLabel1.setText("Wybierz klucz");

        jBOtworzKlucz.setText("Otwórz klucz");

        jBNowyKlucz.setText("Nowy klucz");

        jLabel2.setText("Szyfrowanie:");

        jLabel3.setText("Deszyfrowanie:");

        jBWybierzPlikDeszyfruj.setText("Wybierz plik...");
        jBWybierzPlikDeszyfruj.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton6MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 591, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(jBOtworzKlucz)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jBNowyKlucz))
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jBWybierzPlikSzyfruj)
                            .addComponent(jBWybierzPlikDeszyfruj))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jBDeszyfrujPlik)
                            .addComponent(jBSzyfrujPlik, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 591, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(28, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jBOtworzKlucz)
                    .addComponent(jBNowyKlucz))
                .addGap(17, 17, 17)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addGap(15, 15, 15)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBWybierzPlikSzyfruj)
                    .addComponent(jBSzyfrujPlik))
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(3, 3, 3)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBDeszyfrujPlik)
                    .addComponent(jBWybierzPlikDeszyfruj))
                .addGap(67, 67, 67))
        );

        jBWybierzPlikSzyfruj.getAccessibleContext().setAccessibleName("Wybierz plik...");

        jTabbedPane1.addTab("Plik", jPanel1); // NOI18N  // new javax.swing.ImageIcon(getClass().getResource("/kryptografia/Files-icon.png")),

        jTAWejsce.setColumns(20);
        jTAWejsce.setRows(5);
        jScrollPane1.setViewportView(jTAWejsce);

        jTAWyjscie.setColumns(20);
        jTAWyjscie.setRows(5);
        jScrollPane2.setViewportView(jTAWyjscie);

        jLabel4.setText("Tekst wejściowy");

        jLabel5.setText("Tekst zaszyfrowany / zdeszyfrowany");

        jBSzyfrujTekst.setText("Szyfruj");

        jBDeszyfrujTekst.setText("Deszyfruj");

        jBNowyKluczTekst.setText("Nowy klucz");

        jBOtworzKluczTekst.setText("Wczytaj klucz");

        jLabel6.setText("Wybierz klucz");
        
        JPanel panel = new JPanel();

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2Layout.setHorizontalGroup(
        	jPanel2Layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(jPanel2Layout.createSequentialGroup()
        			.addContainerGap()
        			.addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING)
        				.addComponent(jLabel4)
        				.addGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING, false)
        					.addGroup(jPanel2Layout.createSequentialGroup()
        						.addGap(10)
        						.addComponent(jBSzyfrujTekst)
        						.addGap(18)
        						.addComponent(jBDeszyfrujTekst)
        						.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        						.addComponent(jLabel6)
        						.addGap(18)
        						.addComponent(jBOtworzKluczTekst)
        						.addPreferredGap(ComponentPlacement.RELATED)
        						.addComponent(jBNowyKluczTekst))
        					.addComponent(jScrollPane2, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 588, GroupLayout.PREFERRED_SIZE))
        				.addGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING)
        					.addGroup(jPanel2Layout.createSequentialGroup()
        						.addComponent(jLabel5)
        						.addGap(19)
        						.addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        					.addComponent(jScrollPane1, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 588, GroupLayout.PREFERRED_SIZE)))
        			.addContainerGap(31, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
        	jPanel2Layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(jPanel2Layout.createSequentialGroup()
        			.addContainerGap()
        			.addComponent(jLabel4)
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING)
        				.addComponent(jLabel5)
        				.addComponent(panel, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
        			.addPreferredGap(ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
        			.addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(jBSzyfrujTekst)
        				.addComponent(jBDeszyfrujTekst)
        				.addComponent(jLabel6)
        				.addComponent(jBOtworzKluczTekst)
        				.addComponent(jBNowyKluczTekst))
        			.addContainerGap())
        );
        SpringLayout sl_panel = new SpringLayout();
        panel.setLayout(sl_panel);
        
        JTextArea sygnaturka = new JTextArea();
        sl_panel.putConstraint(SpringLayout.NORTH, sygnaturka, 0, SpringLayout.NORTH, panel);
        sl_panel.putConstraint(SpringLayout.WEST, sygnaturka, 10, SpringLayout.WEST, panel);
        sl_panel.putConstraint(SpringLayout.EAST, sygnaturka, 380, SpringLayout.WEST, panel);
        panel.add(sygnaturka);
        jPanel2.setLayout(jPanel2Layout);

        jTabbedPane1.addTab("Tekst", jPanel2); // NOI18N   // new javax.swing.ImageIcon(getClass().getResource("/kryptografia/stock_text-shadow.png")),

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "AES 128bit", "AES 192bit", "AES 256bit", "ElGamal", "DSA" }));

        jMenu1.setText("O Autorach");
        jMenu1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu1MouseClicked(evt);
            }
        });
        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jTabbedPane1)
                .addGap(28, 28, 28))
        );

        jTabbedPane1.getAccessibleContext().setAccessibleName("Plik");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        Wybierz b = new Wybierz();
        b.setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1MouseClicked

    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2MouseClicked

    private void jButton6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton6MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton6MouseClicked

    private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked
        Autorzy a = new Autorzy();
        a.setVisible(true);
        //Tu czeba zrobic aby sie otwierac New WiNdOOW        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu1MouseClicked

    private void utworzNowyKlucz(MouseEvent evt){
 	   nowyKlucz n = new nowyKlucz();
 	   n.setVisible(true);
    }
    private void dsa(MouseEvent evt) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, NoSuchProviderException{
    	String w= (String) jComboBox1.getSelectedItem();
    	if(w.equals("DSA")){
    		jBDeszyfrujPlik.setText("D");
    	}
    
    }
    private void szyfruj(MouseEvent evt) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, NoSuchProviderException{
    	String s = (String) jComboBox1.getSelectedItem();
    	if (s.equals("AES 128bit")){
    		AES a = new AES();
    		a.ustawKlucz(kluczSzyfrowania.substring(0, 16));
    		a.ustawTekst(jTAWejsce.getText());
    		int[] out=a.algorytmSzyfrowania(a.key4, a.doZaszyfrowania, 128);
    		String str="";
    		for (int i = 0; i < out.length; i++) {
				str+=(char)(out[i]);
			}
    		jTAWyjscie.setText(str);
    	}
    	if (s.equals("AES 192bit")){
    		AES a = new AES();
    		a.ustawKlucz(kluczSzyfrowania.substring(0, 24));
    		a.ustawTekst(jTAWejsce.getText());
    		int[] out=a.algorytmSzyfrowania(a.key6, a.doZaszyfrowania, 192);
    		String str="";
    		for (int i = 0; i < out.length; i++) {
				str+=(char)(out[i]);
			}
    		jTAWyjscie.setText(str);
    	}
    	if (s.equals("AES 256bit")){
    		AES a = new AES();
    		a.ustawKlucz(kluczSzyfrowania.substring(0, 32));
    		a.ustawTekst(jTAWejsce.getText());
    		int[] out=a.algorytmSzyfrowania(a.key8, a.doZaszyfrowania, 256);
    		String str="";
    		for (int i = 0; i < out.length; i++) {
				str+=(char)(out[i]);
			}
    		jTAWyjscie.setText(str);
    	}
    	
    	
        if (s.equals("DSA")){
        	String tekst = new String();
	     	String wynik = new String();
	   	 tekst=jTAWejsce.getText(); 
	   
	   	  podpis p = new podpis();
	   	  p.generujPodpis(tekst);
	   	  wynik=p.wynik();
	 	  t=wynik;
	   	  podpis=p.wynik1(wynik);
	   	  publiczny=p.rpubliczny();
	   	 // podpis=p.sygnatura();
	   	jTAWyjscie.setText(wynik);
	   	  wynik=jTAWyjscie.getText();
        
        }
    }
    
    private void deszyfruj(MouseEvent evt) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException, IOException{
    	String s = (String) jComboBox1.getSelectedItem();
    	if (s.equals("AES 128bit")){
    		AES a = new AES();
    		a.ustawKlucz(kluczSzyfrowania.substring(0, 16));
    		a.ustawTekst(jTAWejsce.getText());
    		int[] out=a.algorytmDeszyfrowania(a.generujKluczeRund(a.key4, 10, 4), a.doZaszyfrowania, 128);
    		String str="";
    		for (int i = 0; i < out.length; i++) {
				str+=(char)(out[i]);
			}
    		jTAWyjscie.setText(str);
    	}
    	if (s.equals("AES 192bit")){
    		
    		AES a = new AES();
    		a.ustawKlucz(kluczSzyfrowania.substring(0, 24));
    		a.ustawTekst(jTAWejsce.getText());
    		int[] out=a.algorytmDeszyfrowania(a.generujKluczeRund(a.key6, 12, 6), a.doZaszyfrowania, 192);
    		String str="";
    		for (int i = 0; i < out.length; i++) {
				str+=(char)(out[i]);
			}
    		jTAWyjscie.setText(str);
    	}
    	if (s.equals("AES 256bit")){
    		AES a = new AES();
    		a.ustawKlucz(kluczSzyfrowania.substring(0, 32));
    		a.ustawTekst(jTAWejsce.getText());
    		int[] out=a.algorytmDeszyfrowania(a.generujKluczeRund(a.key8, 14, 8), a.doZaszyfrowania, 256);
    		String str="";
    		for (int i = 0; i < out.length; i++) {
				str+=(char)(out[i]);
			}
    		jTAWyjscie.setText(str);
    	}
    	
        if (s.equals("DSA")){
        	boolean wer=false;
	     	String tekst = new String();
	     	String wynik = new String();
	     	wynik=sygnaturka.getText();

	   	tekst=jTAWejsce.getText();
	   	  podpis p = new podpis();
	   	  podpis=p.wynik1(t);
	   	wer=p.weryfikacjaPodpisu(publiczny, podpis,tekst,wer );
		  if(wer){
			  jTAWyjscie.setText("podpis porawny");
			   	  }
			   	  else{
			   		jTAWyjscie.setText("niepoprawny podpis");
			   	  }
        
        }
    	
    }
   
   private void wczytajKlucz(MouseEvent evt){
	   File f = new File("key.txt");
	   FileReader fR;
	   try {
			fR = new FileReader(f);
		
		   kluczSzyfrowania = new String();
		   char[] c = new char[32];
		   
		   fR.read(c);
		   
		   for (int i = 0; i < c.length; i++) {
			kluczSzyfrowania+=c[i];
		}
		   
		   System.out.println(kluczSzyfrowania);
		   
	   	} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
   }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */

        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Okno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Okno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Okno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Okno.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Okno().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBWybierzPlikSzyfruj;
    private javax.swing.JButton jBOtworzKluczTekst;
    private javax.swing.JButton jBSzyfrujPlik;
    private javax.swing.JButton jBDeszyfrujPlik;
    private javax.swing.JButton jBOtworzKlucz;
    private javax.swing.JButton jBNowyKlucz;
    private javax.swing.JButton jBWybierzPlikDeszyfruj;
    private javax.swing.JButton jBSzyfrujTekst;
    private javax.swing.JButton jBDeszyfrujTekst;
    private javax.swing.JButton jBNowyKluczTekst;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextArea jTAWejsce;
    private javax.swing.JTextArea jTAWyjscie;
    private javax.swing.JTextArea sygnaturka;
    String kluczSzyfrowania;
}
